package com.leyou.search.pojo;

import lombok.Data;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import javax.persistence.Id;
import java.util.Date;
import java.util.Map;
import java.util.Set;

/**
 * description: 商品索引库实体类
 * @author 朱正磊
 * @date 2021-04-06 18:02:27
 */
@Data
@Document(indexName = "goods", type = "docs", shards = 1, replicas = 0)
public class Goods {

    /**
     * spuId
     */
    @Id
    private Long id;

    /**
     * 所有需要被搜索的信息，包含标题、分类、品牌
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String all;

    /**
     * 卖点
     */
    @Field(type = FieldType.Keyword, index = false)
    private String subTitle;

    /**
     * 品牌id
     */
    private Long brandId;

    /**
     * 1级分类id
     */
    private Long cid1;

    /**
     * 2级分类id
     */
    private Long cid2;

    /**
     * 3级分类id
     */
    private Long cid3;

    /**
     * spu创建时间
     */
    private Date createTime;

    /**
     * 价格
     */
    private Set<Long> price;

    /**
     * sku信息的json结构
     */
    @Field(type = FieldType.Keyword, index = false)
    private String skus;

    /**
     * 可搜索的规格参数，key是规格参数名，value是规格参数值
     */
    private Map<String, Object> specs;

}
